from django.db import models


# Create your models here.


class Content(models.Model):
    class Type:
        QUESTION = "QUESTION"
        ANSWER = "ANSWER"

    class Label:
        TOTAL_STATION = "TOTAL_STATION"
        PSYCHOLOGY = "PSYCHOLOGY"
        E_SPORTS = "E_SPORTS"
        HEALTHY = "HEALTHY"
        RECOMMEND = "RECOMMEND"
        HIGH_PRAISE = "HIGH_PRAISE"

        SCIENCE = "SCIENCE"
        KNOWLEDGE = "KNOWLEDGE"
        CEREBRAL_CAVITY = "CEREBRAL_CAVITY"
        ENTERTAINMENT = "ENTERTAINMENT"
        DIGITAL = "DIGITAL"
        STORY = "STORY"

        GAME = "GAME"
        WORKPLACE = "WORKPLACE"
        FASHION = "FASHION"
        COMIC = "COMIC"
        FINANCE = "FINANCE"
        FOREIGN_LANGUAGES = "FOREIGN_LANGUAGES"

        A_MINORITY = "A_MINORITY"
        INTERNATIONAL = "INTERNATIONAL"
        LAW = "LAW"
        MOVIES = "MOVIES"

    Type = [
        (Type.QUESTION, "问题"),
        (Type.ANSWER, "回答")
    ]

    Label = [
        (Label.TOTAL_STATION, "全站"),
        (Label.PSYCHOLOGY, "心理"),
        (Label.E_SPORTS, "电竞"),
        (Label.HEALTHY, "健康"),
        (Label.RECOMMEND, "种草"),
        (Label.HIGH_PRAISE, "高赞"),

        (Label.SCIENCE, "科学"),
        (Label.KNOWLEDGE, "知识"),
        (Label.CEREBRAL_CAVITY, "脑洞"),
        (Label.ENTERTAINMENT, "娱乐"),
        (Label.DIGITAL, "数码"),
        (Label.STORY, "故事"),

        (Label.GAME, "游戏"),
        (Label.WORKPLACE, "职场"),
        (Label.FASHION, "时尚"),
        (Label.COMIC, "动漫"),
        (Label.FINANCE, "财经"),
        (Label.FOREIGN_LANGUAGES, "外语"),

        (Label.A_MINORITY, "小众"),
        (Label.INTERNATIONAL, "国际"),
        (Label.LAW, "法律"),
        (Label.MOVIES, "影视")
    ]

    content_type = models.CharField("内容类型", choices=Type, max_length=20)
    content_label = models.CharField("内容标签", choices=Label, blank=True, null=True, max_length=20)
    content_title = models.CharField("标题", max_length=50)
    content = models.TextField("内容", blank=True, null=True)
    liked_number = models.IntegerField("内容点赞数", default=0)
    favorite_number = models.IntegerField("内容收藏数", default=0)
    content_create_time = models.DateTimeField("内容创建时间", auto_now=True)
    content_create_people = models.CharField("创建人", max_length=20)

    class Meta:
        db_table = "content"


class People(models.Model):
    class Gender:
        MAN = "MAN"
        WOMAN = "WOMAN"

    GENDER = [
        (Gender.MAN, "男"),
        (Gender.WOMAN, "女")
    ]
    user_head_portrait = models.ImageField("头像", blank=True, null=True)
    nick_name = models.CharField("昵称", max_length=20)
    user_name = models.CharField("姓名", max_length=20, blank=True, null=True)
    student_id = models.CharField("学号", max_length=20, blank=True, null=True)
    college = models.CharField("学院", max_length=50, blank=True, null=True)
    major = models.CharField("专业", max_length=20, blank=True, null=True)
    grade = models.CharField("班级", max_length=20, blank=True, null=True)
    gender = models.CharField("性别", choices=GENDER, max_length=50, blank=True, null=True)
    birthday = models.CharField("生日", max_length=50, blank=True, null=True)
    hometown = models.CharField("家乡", max_length=50, blank=True, null=True)
    qq_number = models.CharField("qq号", max_length=50, blank=True, null=True)
    wechat_number = models.CharField("微信号", max_length=50, blank=True, null=True)
    visible_information = models.BooleanField("个人信息可见", default=False)
    personal_signature = models.CharField("个性签名", max_length=50, blank=True, null=True)
    questions_number = models.IntegerField("提问题数", default=None)
    answers_number = models.IntegerField("回答题数", default=None)
    favorite_content = models.ManyToManyField(Content, related_name="favorite")
    like_content = models.ManyToManyField(Content, related_name="like")
    message_notification = models.CharField("消息通知", blank=True, null=True, max_length=100)

    class Meta:
        db_table = "people"
